home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Languages
/
MacQForth 1.0
/
asm6502
/
demo
/
demo3.s
< prev
next >
Wrap
Text File
|
1995-03-20
|
620b
|
27 lines
; Print 20 random numbers from 0..100
PUSH = $20B2 ; QForth stack equates
POP = $20CA
RND2 = $FF92 ; random number off stack
HOUT = $FDDA ; output A as a hex number
COUT = $FDED ; output A as a character
COUNT = $03FF ; count in here
*= $0300
lda #$14 ; setup count
sta COUNT
LOOP ldy #$64 ; 100 in Y and X
ldx #$00
jsr PUSH ; ( 100 -- )
jsr RND2 ; ( -- 0..100 )
jsr POP ; in Y and X
tya ; n' -> A
jsr HOUT ; print it
lda #$0D ; carriage return
jsr COUT
dec COUNT ; count <- count - 1
bne LOOP ; not done
rts ; done